package com.backend.springboot_project_demo.controller;

import com.backend.springboot_project_demo.common.Result;
import com.backend.springboot_project_demo.entity.Usage;
import com.backend.springboot_project_demo.entity.UserTransfer;
import com.backend.springboot_project_demo.service.UsageService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/usage")
public class UsageController {
    private @Resource UsageService usageService;

    @PostMapping("/login")
    public Result<?> login(@RequestBody Usage usage) {
        return usageService.login(usage);
    }

    @PostMapping("/logout")
    public Result<?> logout() {
        return usageService.logout();
    }

    @PostMapping("/register")
    public Result<?> register(@RequestBody UserTransfer userTransfer) {
        return usageService.register(userTransfer);
    }
}
